# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-voluptuous
_pkgname=voluptuous
pkgver=0.14.1
pkgrel=0
pkgdesc="Python data validation library"
url="https://github.com/alecthomas/voluptuous"
license="BSD-3-Clause"
arch="noarch"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-voluptuous" # Backwards compatibility
provides="py-voluptuous=$pkgver-r$pkgrel" # Backwards compatibility

prepare() {
	default_prepare
	# https://github.com/alecthomas/voluptuous/issues/333
	rm -rf ./*.egg-info
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest voluptuous/tests/tests.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
807d060eb9f23aadae66f16b40ced553af3ed405ffa121c393f4629542f08e3ac0d5f956b501196176f2c8a1c9ab5646abff638792a54ac752a91cd65efd4a7e  voluptuous-0.14.1.tar.gz
"
